package InterpreterPattern;

import com.sun.org.apache.xpath.internal.operations.And;

public class Main {
    public static void main(String[] args) {

        //刘刘和毛毛都会变得很有钱
        Expression liuyunfeng = new TerminalExpression("liuyunfeng");
        Expression maochunyan = new TerminalExpression("maochunyan");
        Expression willBeRich = new OrExpression(liuyunfeng, maochunyan);

        Expression married = new TerminalExpression("married");
        Expression we = new TerminalExpression("we");
        Expression weMarried = new AndExpression(married, we);

        System.out.println(willBeRich.interpreter("liuyunfeng"));
        System.out.println(weMarried.interpreter("we weill married"));
    }
}
